cmake_minimum_required(VERSION 3.20)
project(CEC_VISION)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

set(CMAKE_PREFIX_PATH "/home/cy/Public/Qt/6.3.0/gcc_64")
# Qt所需的相关配置

set(OpenCV_DIR /home/cy/SoftWare/OpenCV4/lib/cmake/opencv4/)
set(Eigen3_DIR /home/cy/SoftWare/Eigen3/share/eigen3/cmake/)
# 制定OpenCV和Eigen3的目录

set(HTCamera_INCLUDE /home/cy/SoftWare/HtVision/include)
set(HTCamera_LIBS /home/cy/SoftWare/HtVision/lib)
# 工业相机库和串口通信库

set(TEST_CAMERA_SOURCE
        ${CEC_VISION_SOURCE_DIR}/modules/src/camera.cpp
        ${CEC_VISION_SOURCE_DIR}/modules/src/except.cpp
        ${CEC_VISION_SOURCE_DIR}/3rdpart/src/stacktrace.cpp)
set(TEST_ARMOR_SOURCE
        ${TEST_CAMERA_SOURCE}
        ${CEC_VISION_SOURCE_DIR}/modules/src/armor.cpp)
set(TEST_BUFFER_SOURCE
        ${TEST_CAMERA_SOURCE}
        ${CEC_VISION_SOURCE_DIR}/modules/src/buffer.cpp)
set(TEST_FILTER_ARMOR_SOURCE
        ${TEST_ARMOR_SOURCE}
        ${CEC_VISION_SOURCE_DIR}/modules/src/calculate.cpp)
set(TEST_FILTER_BUFFER_SOURCE
        ${TEST_BUFFER_SOURCE}
        ${CEC_VISION_SOURCE_DIR}/modules/src/calculate.cpp)
set(TEST_TRANCE_SOURCE
        ${CEC_VISION_SOURCE_DIR}/modules/src/trance.cpp
        ${CEC_VISION_SOURCE_DIR}/modules/src/except.cpp
        ${CEC_VISION_SOURCE_DIR}/3rdpart/src/stacktrace.cpp)
# 以上是测试文件的cpp文件列表

set(FINAL_ARMOR_SOURCE
        ${TEST_FILTER_ARMOR_SOURCE}
        ${CEC_VISION_SOURCE_DIR}/modules/src/trance.cpp)
set(FINAL_BUFFER_SOURCE
        ${TEST_FILTER_BUFFER_SOURCE}
        ${CEC_VISION_SOURCE_DIR}/modules/src/trance.cpp)
set(FINAL_VISION_SOURCE
        ${CEC_VISION_SOURCE_DIR}/modules/src/camera.cpp
        ${CEC_VISION_SOURCE_DIR}/modules/src/armor.cpp
        ${CEC_VISION_SOURCE_DIR}/modules/src/buffer.cpp
        ${CEC_VISION_SOURCE_DIR}/modules/src/calculate.cpp
        ${CEC_VISION_SOURCE_DIR}/modules/src/trance.cpp
        ${CEC_VISION_SOURCE_DIR}/modules/src/except.cpp
        ${CEC_VISION_SOURCE_DIR}/3rdpart/src/stacktrace.cpp)
# 以上是最终程序的cpp文件列表


set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/dist)
# 将测试程序和最终程序的输出定向到dist文件夹

find_package(Qt6 COMPONENTS
        Core
        Gui
        Widgets
        REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Eigen3 REQUIRED)
# 寻找Qt、OpenCV、Eigen3和Json库模块

include_directories(
        ${HTCamera_INCLUDE}
        ${EIGEN3_INCLUDE_DIRS}
        ${OpenCV_INCLUDE_DIRS}
        modules/include/
        3rdpart/include)
# 为所有程序引入头文件

set(ALL_TARGET_LINK
#        Qt::Core
#        Qt::Widgets
#        Qt::Gui
        libMVSDK.so
        libjsoncpp.so
        libbfd.so
        libserial.so
        ${OpenCV_LIBS}
        )
# 为所有程序引入动态链接库(Eigen3和Json头文件模式所以不需要链接，而且find_package已经自动加入)
message(STATUS ${EIGEN3_INCLUDE_DIR})
add_subdirectory(base base-test)
# 进入测试文件夹进行各程序的Cmake执行
